<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function Person(name,age){
        //     this.name = name;
        //     this.age = age;
        //     this.country = '中国'
        // }

        // Person.prototype.unit = function(){
        //     console.log('中国统一大业必将实现')
        // }

        // var p1 = new Person('张三',18);
        // var p2 = new Person('李四',19);
        // console.log(p1.name,p1.age,p1.country);
        // p1.unit()
        // console.log(p2.name,p2.age,p2.country);
        // p2.unit()


        class Person{
            constructor(name,age){
                this.name = name;
                this.age = age;
                this.country = '中国';
            }
            unit(){
                console.log('中国统一大业必将实现')
            }
        }

        var p1 = new Person('张三',18);
        var p2 = new Person('李四',19);
        console.log(p1.name,p1.age,p1.country);
        p1.unit()
        console.log(p2.name,p2.age,p2.country);
        p2.unit()

    </script>
</body>
</html>